﻿using CSRedis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorkOne.Domain.Redis
{
    public class RedisHelpers
    {
        private static readonly object _lock = new object();
        private static CSRedisClient _redis = null;

        public CSRedisClient Redis
        {
            get
            {
                if (_redis == null)
                {
                    lock (_lock)
                    {
                        if (_redis == null)
                        {
                            _redis = new CSRedisClient("127.0.0.1:6379");
                        }
                    }
                }
                return _redis;
            }
        }

        public static RedisClient _redisclient = null;

        public RedisClient Redisclient
        {
            get
            {
                if (_redisclient == null)
                {
                    lock (new object())
                    {
                        if (_redisclient == null)
                        {
                            _redisclient = new RedisClient("127.0.0.1:6379");
                        }
                    }
                }
                return _redisclient;
            }
        }
    }
}